<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use kartik\select2\Select2;
use kartik\date\DatePicker;

$this->title = '团队收入统计';

?>
<style type="text/css">
	.search{margin: 10px;}
	.detail{padding-bottom: 40px;}
	.download{margin-right:60px;}
	.one{margin:20px;border: 1px solid #ddd;border-radius: 4px;text-align: center;padding: 15px;}
	.p1{font-size: 16px;font-weight: bold;}
</style>

<div class="row">

	<div class="col-md-12">	
		<div class="box box-primary">
		        <div class="box-body no-padding">

		        	<div class="search">
		        		<?php $form = ActiveForm::begin([
					        'action' => [''],
					        'method' => 'get',
					        'layout' => 'inline',
					        'options' => [
					            'data-pjax' => 1
					        ],
					 	]); ?>

					    <?php echo '<div class="form-group" style="width:300px;"><label class="sr-only">姓名</label>';
					          echo Select2::widget([
					              'value'=> isset($params['u_id']) ? $params['u_id'] : '',
					              'name' => 'u_id',
					              'data' => $user_arr,
					              'options' => [
					                  'placeholder' => '选择员工','multiple'=>true,
					              ],
					              'pluginOptions' => [
					                    'allowClear' => true,
					              ],
					          ]);
					          echo '</div>';
					    ?> 

					    <?php  echo '<div class="form-group" style="width:240px;">';
                            echo DatePicker::widget([
                                'name' => 'from_date',
                                'value' => isset($params['from_date']) ? $params['from_date'] : '',
                                'type' => DatePicker::TYPE_RANGE,
                                'name2' => 'to_date',
                                'value2' => isset($params['to_date']) ? $params['to_date'] : '',
                                'separator' => '到',
                                'options' => ['placeholder' => '起始日期'],
                                'options2' => ['placeholder' => '结束日期'],
                                'pluginOptions' => [
                                    'autoclose'=>true,
                                    'format' => 'yyyy-mm-dd'
                                ]
                            ]);

                            echo '</div>';
                    	 ?>

                    	 <div class="form-group">
					        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
					        <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
					    </div>

					    <?php ActiveForm::end(); ?>
					</div>
					
					<div class="download">
						<a class="pull-right btn btn-success" href="<?=Url::toRoute(['/product/data/download'])."?".http_build_query($params) ?>">下载详情</a>
					</div>

					<div style="clear: both;">
					</div>
						
					<div class="row detail">

						<div class="col-md-3">
							<div class="one">
		                           <p class="p1">团队数量</p>
		                           <p class="p1"><?=$data['num']?></p>
		                     </div> 
		                </div>

		                <div class="col-md-3">
							<div class="one">
		                           <p class="p1">总收入</p>
		                           <p class="p1"><?=$data['price']?></p>
		                     </div> 
		                </div>

		                <div class="col-md-3">
							<div class="one">
		                           <p class="p1">总毛利</p>
		                           <p class="p1"><?=$data['profit_price']?></p>
		                     </div> 
		                </div>
						
						<div class="col-md-3">
							<div class="one">
		                           <p class="p1">总毛利率</p>
		                           <p class="p1"><?=$data['profit']?>%</p>
		                     </div> 
		                </div>

		                <div class="col-md-3">
							<div class="one">
		                           <p class="p1">总欠款金额</p>
		                           <p class="p1"><?=$data['not_income_price']?></p>
		                     </div> 
		                </div>

					</div>

		        </div>
		</div>
	</div>
</div>